﻿using IntelligentAgriculture.Contracts.Dto.Output;
using IntelligentAgriculture.Contracts.Interface;
using IntelligentAgriculture.WebAPI.Application.Command.BodyMeasureModel;
using IntelligentAgriculture.WebAPI.Application.Command.BreedingWeighCommand;
using IntelligentAgriculture.WebAPI.Application.CommandHandler.BreedingWeighCommandHandler;
using MediatR;

namespace IntelligentAgriculture.WebAPI.Application.CommandHandler.BodyMeasureModelCommandHandler
{
    public class BodyMeasureModelQueryCommandHandler : IRequestHandler<BodyMeasureModelQueryCommand, Results<PageOutput<BodyMeasureModelOutPut>>>
    {


        private readonly IBodyMeasureModelService bodymeasureService;
        private readonly ILogger<BodyMeasureModelQueryCommandHandler> logger;
        public BodyMeasureModelQueryCommandHandler(IBodyMeasureModelService bodymeasureService, ILogger<BodyMeasureModelQueryCommandHandler> logger)
        {
            this.bodymeasureService = bodymeasureService;
            this.logger = logger;
        }

        public async Task<Results<PageOutput<BodyMeasureModelOutPut>>> Handle(BodyMeasureModelQueryCommand request, CancellationToken cancellationToken)
        {
            var list = await bodymeasureService.BodyMeasureModelList(request.BodyMeasure);
            var results = Results<PageOutput<BodyMeasureModelOutPut>>.DataResult(list);
            return results;
        }





    }





}
